/**    
 * 文件名：DepositPamentManager.java</br>
 *    
 * 版本信息：v1.0</br>
 * 日期：2017年7月6日</br>
 * © 2005-2017 雷技信息科技（上海）有限公司版权所有</br>
 *
 */
package com.logic.landseaserver.service.bill.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.logic.common.exception.BusinessException;
import com.logic.landseaserver.common.LandeaConstants;
import com.logic.landseaserver.common.LandeaConstants.BillType;
import com.logic.landseaserver.common.exception.LandseaException;
import com.logic.landseaserver.domain.BillPayment;
import com.logic.landseaserver.domain.Deposit;
import com.logic.landseaserver.persistence.read.DepositReadMapper;
import com.logic.landseaserver.service.bill.PaymentManager;
import com.logic.landseaserver.ws.dto.WeBankPayReqDTO;

/**
 *
 * 项目名称：system-server</br>
 * 类名称：DepositPamentManager</br>
 * 类描述：预定账单</br>
 * 创建人：Aaron</br>
 * 创建时间：2017年7月6日 下午8:10:04</br>
 * 
 * @version 1.0
 *
 */
@Service(LandeaConstants.BILLTYPE_PREFIX + BillType.RESERVE_BILL)
public class DepositPamentManager implements PaymentManager
{
    //private static final Logger LOG = LoggerFactory.getLogger(DepositPamentManager.class);
    
    @Autowired
    private DepositReadMapper depositReadMapper; 
    
    /**
     * [描述]：预定账单不存在校验，只要把账单表里的price赋值到payment中</br>
     *
     * @param billPayment
     * @throws LandseaException 如果检查非法会报异常
     *
     */
    @Override
    public Double checkAmountMoney(BillPayment billPayment)
        throws LandseaException
    {
        return billPayment.getMoney();
    }

    /**    
     * [描述]：</br>
     *
     * @param billId
     * @return
     * @throws LandseaException
     *
    */
    @Override
    public Integer getContractId(Integer billId)
        throws LandseaException
    {
        return billId;
    }

    @Override
    public String getPrice(WeBankPayReqDTO payinfo)
        throws LandseaException, BusinessException
    {
        Integer billId = payinfo.getBillId();
        Deposit deposit = depositReadMapper.selectByPrimaryKey(billId);
        
        return deposit.getDepositAmount() + "";
    }
}
